home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / COMPTOOL / ACTVCOMP / COFFEE / CO2CONN.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1996-11-27  |  2.0 KB  |  58 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Connector"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = True
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11. ' > For an overview of this sample application, search
  12. '   online Help for Coffee.
  13. ' > AboutCof.Txt, in the Related Documents folder of
  14. '   CoffWat2.vbp, also contains information about the sample.
  15.  
  16. ' Connector class
  17. ' ---------------
  18. ' The Connector allows multiple clients to share a single
  19. '   CoffeeMonitor object.  The Connector class has its
  20. '   Instancing property set to MultiUse, so each client
  21. '   can create its own Connector.  Each of the Connector
  22. '   objects returns a reference to the single shared
  23. '   CoffeeMonitor object, so all the clients share the
  24. '   same CoffeeMonitor.  (See the CoffeeMonitor property,
  25. '   below.)
  26. '
  27. ' If you read "Creating an ActiveX Exe Component," in
  28. '   Books Online, you'll notice a difference:  This
  29. '   version of Connector doesn't have a 'use count' that
  30. '   determines when gCoffeeMonitor should be set to
  31. '   Nothing.  There's no need for Initialize event code
  32. '   to increment the use count, or Terminate event code to
  33. '   decrement and test the use count.
  34. '
  35. ' This solves a bug described in the topic "Using the
  36. '   Shared CoffeeMonitor" in the chapter mentioned
  37. '   above.  For an explanation of why the use count
  38. '   isn't needed, and how this fixes the bug, see the
  39. '   CoffeeMonitor class module.
  40.  
  41.  
  42. ' CoffeeMonitor property always returns the single global
  43. ' -------------   reference to the shared instance of
  44. '   CoffeeMonitor (which is created the first time a client
  45. '   requests a CoffeeMonitor).
  46. '
  47. Public Property Get CoffeeMonitor() As CoffeeMonitor
  48.     ' If the shared CoffeeMonitor object hasn't been
  49.     '   created, create it and store a global reference
  50.     '   to it.
  51.     If gCoffeeMonitor Is Nothing Then
  52.         Set gCoffeeMonitor = New CoffeeMonitor
  53.     End If
  54.     
  55.     Set CoffeeMonitor = gCoffeeMonitor
  56. End Property
  57.     
  58.